package com.lza.phone.mapper;

import com.lza.phone.entity.Soc;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lza.phone.entity.connectEntity.SocAndPer;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 李钊澳
 * @since 2021-08-28
 */
public interface SocMapper extends BaseMapper<Soc> {
    @Results({
            @Result(column ="performanceId",property = "performance" ,one=@One(select = "com.lza.phone.mapper.PerformanceMapper.selectById",fetchType= FetchType.EAGER))
    })
    @Select("select s.socName,per.* from soc s \n" +
            "\tINNER JOIN \n" +
            "\tperformance per\n" +
            "\ton s.socId=per.performanceId\n" +
            "\tORDER BY per.cpuPkMark DESC\n" +
            "\t")
    List<SocAndPer> cpuByPer();

}
